package com.zr.util;

import lombok.Data;

@Data
public class ResultVo<T> {
    private boolean success;
    private String errorCode;
    private String errorMessage;
    private T data;//正常数据
//    private Object hint;//异常数据
//    private Object[] errorArgs;
public static<T> ResultVo success(T data) {
    ResultVo resultVo = new ResultVo();
    resultVo.setSuccess(true);
    resultVo.setData(data);
    return resultVo;
}

    public static<T> ResultVo success() {
        ResultVo resultVo = new ResultVo();
        resultVo.setSuccess(true);
        return resultVo;
    }

    public static ResultVo error(String errorMessage) {
        ResultVo resultVo = new ResultVo();
        resultVo.setSuccess(false);
        resultVo.setErrorMessage(errorMessage);
        return resultVo;
    }
    public static ResultVo error() {
        ResultVo resultVo = new ResultVo();
        resultVo.setSuccess(false);
        return resultVo;
    }

    public static ResultVo notLogin(String errorMessage) {
        ResultVo resultVo = new ResultVo();
        resultVo.setSuccess(false);
        resultVo.setErrorMessage(errorMessage);
        return resultVo;
    }
}